package com.itheima.orderservice.controller;

import com.itheima.bestcommon.pojo.Order;
import com.itheima.bestcommon.pojo.User;
import com.itheima.feignclient.base.OrderApi;
import com.itheima.feignclient.clients.UserClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


/**
 * OrderController
 *
 * @author liliudong
 * @version 1.0
 * @description
 * @date 2023/7/20 16:43
 */
@RestController
public class OrderController implements OrderApi {

    @Autowired
    private UserClient userClient;

    @Override
    public Order getById(@PathVariable Integer id) {
        Order order = new Order();
        User user = userClient.getById(1);

        order.setId(id);
        order.setOrderSn("123456");
        order.setUser(user);

        return order;
    }
}
